package com.shop.Control;

import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.io.StringBufferInputStream;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.Cookie;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.shop.actionentity.MerchantLogin;
import com.shop.service.MerchantServiceImpl;
import com.shop.util.FormAjaxUtil;
import com.shop.util.GetBase64Util;
import com.shop.util.VerCodeUtil;

/**
 * 
 * <b>登录验证码<b>
 * @author 威 
 * <br>2017年12月
 *
 */
public class MerchantVercodeAction extends SuperActionSupport{
	private static final long serialVersionUID = 1L;
	
	public String execute(){
		String result = "" ;
		//判断上一次是否有设置自动登录的账号
		Object[] obj = VerCodeUtil.createVerCode() ;
		BufferedImage img=(BufferedImage)obj[0] ;//获取画好的图片
		result += "data:image/png;base64," + GetBase64Util.getBaseToImage(img) ;
		result += "-*-" + (String)obj[1] ;
		print(result) ;
		return SUCCESS ;
	}
}

